//
//  RTJCapitalSubsidiaryCell.m
//  RuiTaiJinProject
//
//  Created by jayson on 2018/12/11.
//  Copyright © 2018年 leewei. All rights reserved.
//

#import "RTJCapitalSubsidiaryCell.h"

@implementation RTJCapitalSubsidiaryCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code

    [self layershadowRadius:_bg_view];
    [self layershadowRadius:_bg_view1];
    [self layershadowRadius:_bg_view2];
    [self layershadowRadius:_bg_view7];
    [self layershadowRadius:_bg_view8];

}

-(void)layershadowRadius:(UIView *)bg_views {
    
    bg_views.layer.cornerRadius = 5;
    bg_views.layer.shadowColor = [UIColor colorForHex:@"#dbc9cc"].CGColor;
    bg_views.layer.shadowOffset = CGSizeMake(-1, 1);
    bg_views.layer.shadowOpacity = 0.5;
    bg_views.layer.shadowRadius = 5;
}

-(void)setData:(NSDictionary *)data{
    
    if (_isOpen) {
        
        self.bg_viewHeight.constant = 80;
        self.lab1H.constant = 0;
        self.lab2H.constant = 0;
        self.lab3H.constant = 0;
        self.top1.constant = 0;
        self.top2.constant = 0;
        self.top3.constant = 0;
        self.shuomingLab.hidden = YES;
        
    }
    
    
    _titleType.text = data[@"type_format"];
    _zhanghuTime.text = data[@"log_time"];
    _yinxiangLab.text = [NSString stringWithFormat:@"%@ 元",data[@"money_format"]];
    _keyongLab.text = [NSString stringWithFormat:@"可用金额:%@ 元",data[@"balance_format"]];
    _dongjieLab.text = [NSString stringWithFormat:@"冻结资金:%@ 元",data[@"lock_money_format"]];
    _daishouLab.text = [NSString stringWithFormat:@"待收金额:%@ 元",data[@"daishou_format"]];
    _zhanghuLab.text = [NSString stringWithFormat:@"账户总额:%@ 元",data[@"total_money_format"]];
    
    NSString *str = [NSString stringWithFormat:@"%@",data[@"log_info"]];
    _shuomingLab.text = str.length!=0 ? [NSString stringWithFormat:@"说明: %@",data[@"log_info"]] : @"说明：暂无说明";
}


-(void)setChongzhidata:(NSDictionary *)chongzhidata{
    
    if (_isOpen) {
        
        self.bg_viewHeight2.constant = 80;
        self.chongzhiTop2.constant = 0;
        self.chongzhiTop3.constant = 0;
        self.chongzhiLab2.constant = 0;
        self.chongzhiShuoming.hidden = YES;
        
    }
  
    NSString *is_paid_format = [NSString stringWithFormat:@"%@",chongzhidata[@"is_paid_format"]];
    
    _chongzhiTime.text = [NSString stringWithFormat:@"%@",chongzhidata[@"create_time_format"]];
    _chongzhititle.text = is_paid_format;
    _chongzhititle.textColor = ![is_paid_format isEqualToString:@"未支付"] ? [UIColor colorForHex:@"#468B46"] :[UIColor colorForHex:@"#FD3834"];
    
    _chongzhiMoney.text = [NSString stringWithFormat:@"%@ 元",chongzhidata[@"money_format"]];
    _chongzhiType.text = [NSString stringWithFormat:@"充值方式：%@",chongzhidata[@"name"]];
    _chongzhiNum.text = [NSString stringWithFormat:@"支付订单:%@",chongzhidata[@"notice_sn"]];
    
    NSString *str = [NSString stringWithFormat:@"%@",chongzhidata[@"memo"]];
    _chongzhiShuoming.text = str.length!=0 ? [NSString stringWithFormat:@"说明: %@",chongzhidata[@"memo"]] : @"说明：暂无说明";
    
}

-(void)setTixiandata:(NSDictionary *)tixiandata{
    
    _tixianLab.text = tixiandata[@"status_format"];
    
    if ([_tixianLab.text isEqualToString:@"已撤销"]) {
        
        _chexiaoBtn.hidden = YES;
    }
    
    if(_isOpen){
        
        self.bg_view1Height.constant = 80;
        self.tixianH1.constant = 0;
        self.tixanH2.constant = 0;
        self.tixianTop1.constant = 0;
        self.tixianTop2.constant = 0;
        self.tixainTop3.constant = 0;
        self.tixianShuoming.hidden = YES;
    }
    
    _tixianMoney.text = [NSString stringWithFormat:@"%@ 元",tixiandata[@"money"]];
    _shouxufei.text = [NSString stringWithFormat:@"手续费:%@ 元",tixiandata[@"fee"]];
    _tixianBank.text = [NSString stringWithFormat:@"提现银行:%@（%@）",tixiandata[@"bank_name"],tixiandata[@"bankcards"]];
    _tixianTime.text = [NSString stringWithFormat:@"提现时间:%@ ",tixiandata[@"apply_time"]];
    
    NSString *str = [NSString stringWithFormat:@"%@",tixiandata[@"desc"]];
    _tixianShuoming.text = str.length!=0&&str!=nil ? [NSString stringWithFormat:@"说明：%@",str] : @"说明：暂无说明";
    
}

-(void)setJiekuandata:(NSDictionary *)jiekuandata{
    
    if(_isOpen){
        
        self.jiekuanBgH.constant = 80;
        self.jiekuanH1.constant = 0;
        self.jiekuanH2.constant = 0;
        self.jiekuanH3.constant = 0;
        self.jiekuanH4.constant = 0;
        self.jiekuanH5.constant = 0;
        self.jiekuanH6.constant = 0;
        self.jiekuanH7.constant = 0;
        self.jiekuanH8.constant = 0;
        self.jiekuanH9.constant = 0;
        self.jiekuanH10.constant = 0;
        self.jiekuanH11.constant = 0;
        self.jiekuanH12.constant = 0;
        self.jiekuanTop1.constant = 0;
        self.jiekuanTop2.constant = 0;
        self.jiekuanTop3.constant = 0;

    }
    
    _jiekuan.text =[NSString stringWithFormat:@"%@",jiekuandata[@"real_name"]] ;
    _zhengjian.text = [NSString stringWithFormat:@"%@",jiekuandata[@"id_card"]];
    _yongtu.text = [NSString stringWithFormat:@"%@",jiekuandata[@"purpose"]];
    _jiekuanjin.text = [NSString stringWithFormat:@"%@ 元",jiekuandata[@"borrow_amount_format"]];
    _jiekuanqixian.text = [NSString stringWithFormat:@"%@ 个月",jiekuandata[@"repay_time"]];
    _huankuanType.text = [NSString stringWithFormat:@"%@",jiekuandata[@"loantype_format"]];
    _xinyong.text = [NSString stringWithFormat:@"%@ 分",jiekuandata[@"zhima_credit"]];
    _zhifubao.text = [NSString stringWithFormat:@"%@",jiekuandata[@"alipay_account"]];
    _oldLab.text = [NSString stringWithFormat:@"%@ 岁",jiekuandata[@"age"]];
    _zhiye.text = [NSString stringWithFormat:@"%@",jiekuandata[@"profession"]];
    
}

-(void)setAutodata:(NSDictionary *)autodata{

    if (_isOpen) {
        
        _autoTop1.constant = 0;
        _autoTop2.constant = 0;
        _autoTop3.constant = 0;
        _autoTop4.constant = 0;
        _autoTo5.constant = 0;
        _autoH1.constant = 0;
        _autoH2.constant = 0;
        _autoH3.constant = 0;
        _autoH5.constant = 0;
        _lineView.hidden = YES;
        _autoBgH4.constant = 85;
        _autoBtnH.constant = 0;
        _autoH4.constant = 0;

    }else{
        
        NSInteger is_completion_contract = [autodata[@"is_completion_contract"] integerValue];
        
        if (is_completion_contract == 0) {
            
            _lineView.hidden = YES;
            _autoH4.constant = 0;
            _autoBtnH.constant = 0;
            _autoTop4.constant = 0;
            _autoTo5.constant = 0;
            _autoBgH4.constant = 228.5-17-11-11;
            
        }
        
    }
    
    
    _autoTitle.text = [NSString stringWithFormat:@"%@",autodata[@"name"]];
    _autoshouyi.text = [NSString stringWithFormat:@"预期收益：%@元",autodata[@"profit_format"]];
    _autoType.text = [NSString stringWithFormat:@"%@",autodata[@"deal_status_format"]];
    _automoney.text = [NSString stringWithFormat:@"%@元",autodata[@"money_format"]];
    _autorate.text = [NSString stringWithFormat:@"预期年化：%@%@",autodata[@"rate"],@"%"];
    _autoTime.text = [NSString stringWithFormat:@"出借期限：%@个月",autodata[@"repay_time"]];
    _autohaikuan.text = [NSString stringWithFormat:@"还款方式：%@",autodata[@"loantype_format"]];
    _autochujie.text = [NSString stringWithFormat:@"出借日期：%@",autodata[@"create_time"]];



}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
